/*	 

Program Convert converts a temperature in Fahrenheit to
Celsius and a temperature in Celsius to Fahrenheit.

 *	Version 0.2.6

 *	copyright (c) 200232298 2003
 * 
 *	This program is free software: you can redistribute it and/or modify
 *	it under the terms of the GNU General Public License as published by
 *	the Free Software Foundation, either version 3 of the License, or (at
 *	your option) any later version.
 *
 *	This program is distributed in the hope that it will be useful, but
 *	WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *	General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program.  If not, see <https://www.gnu.org/licenses/>.

 * this is originally based off of example boilerplate code from uregina probably CS 110 in 2002.
 * but has been slowly rewritten
 
 */

#include <iostream>
using namespace std;
int main ()
{	int fToC;		// Place to store Celsius answer
	int cToF;		// Place to store the Fahrenheit answer
	char corf='f';
	int tempinf=32, tempinc=0;
	/*	variables are as follows:
		fToC : Place to store Celsius awnser
		cToF : Place to store Farenheit awnser
		char corf : descision character
		tempinf : tempurature inputted in farenheit
		tempinc : tempurature inputted in celsius
		*/
	cout 	<< "\nThis Program will convert between Celsius"
		<< " and Ferenheit Degree'd Tempurature"
		<< "\nPlease enter\n \"C\" (for Celsius to Farenheit Conversion)"
		<< "\nor\n \"F\" (for Farenheit to Celsius"
		<< " Conversion)\n?";
	/*	instructions
		*/
	cin >> corf;
	/*	input / Descision Split
		*/
	if(corf=='C'||corf=='c')
	{	cout	<< "Please Enter the amount you have in Celsius\n?";
		cin >> tempinc;
		cToF = (int)(9*(((float)(tempinc))/5.0)) + 32;
		cout	<< endl << tempinc << " in Celsius is\n " << cToF
			<< " in Farenheit "  << endl;
		return(0);
		}
	/*	The above function computes the tempurature in farenheit from
		celsius, the below function computes the tempurature in 
		celsius from farenheit
		*/
	if(corf=='F'||corf=='f')
	{	cout	<< "Please Enter the amount you have in Farenheit\n?";
		cin >> tempinf;
		fToC = (int)(5*((float)(tempinf-32))/9.0); 
		cout	<< endl <<tempinf << " in Fahrenheit is\n " 
			<< fToC << " in Celsius. "  << endl;
		return(0);
		}
	cout<<"\nError #4: c or f expected";
	return(1);
	//shotgun debugging notabug
}

